home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / lisp / hyperbole / hgnus.el < prev    next >
Encoding:
Text File  |  1995-08-11  |  4.8 KB  |  137 lines

  1. ;;!emacs
  2. ;;
  3. ;; FILE:         hgnus.el
  4. ;; SUMMARY:      Support Hyperbole buttons in news reader/poster: GNUS.
  5. ;; USAGE:        GNU Emacs Lisp Library
  6. ;; KEYWORDS:     hypermedia, news
  7. ;;
  8. ;; AUTHOR:       Bob Weiner
  9. ;; ORG:          Brown U.
  10. ;;
  11. ;; ORIG-DATE:    24-Dec-91 at 22:29:28 by Bob Weiner
  12. ;; LAST-MOD:      8-Aug-95 at 10:53:53 by Bob Weiner
  13. ;;
  14. ;; This file is part of Hyperbole.
  15. ;; Available for use and distribution under the same terms as GNU Emacs.
  16. ;;
  17. ;; Copyright (C) 1991-1995, Free Software Foundation, Inc.
  18. ;; Developed with support from Motorola Inc.
  19. ;;
  20. ;; DESCRIPTION:  
  21. ;;
  22. ;;   This only works with GNUS 3.15 or above, so be sure to check your
  23. ;;   newsreader version {M-ESC gnus-version RET} before reporting any
  24. ;;   problems.
  25. ;;
  26. ;;   Automatically configured for use in "hyperbole.el".
  27. ;;   If hsite loading fails prior to initializing Hyperbole Gnus support,
  28. ;;
  29. ;;       {M-x Gnus-init RTN}
  30. ;;
  31. ;;   will do it.
  32. ;;
  33. ;;
  34. ;;   Have not yet overloaded 'news-reply-yank-original'
  35. ;;   to yank and hide button data from news article buffer.
  36. ;;
  37. ;; DESCRIP-END.
  38.  
  39. ;;; ************************************************************************
  40. ;;; Other required Elisp libraries
  41. ;;; ************************************************************************
  42.  
  43. (require 'hmail)
  44. (require 'hsmail)
  45. (require 'gnuspost)
  46.  
  47. ;;; ************************************************************************
  48. ;;; Public variables
  49. ;;; ************************************************************************
  50.  
  51. (setq hnews:composer 'news-reply-mode
  52.       hnews:lister   'gnus-summary-mode
  53.       hnews:reader   'gnus-article-mode)
  54.  
  55.  
  56. ;;; ************************************************************************
  57. ;;; Public functions
  58. ;;; ************************************************************************
  59.  
  60. (defun Gnus-init ()
  61.   "Initializes Hyperbole support for Gnus Usenet news reading."
  62.   (interactive)
  63.   nil)
  64.  
  65. (defun lnews:to ()
  66.   "Sets current buffer to the Usenet news article summary listing buffer."
  67.   (and (eq major-mode hnews:reader) (set-buffer gnus-summary-buffer)))
  68.  
  69. (defun rnews:to ()
  70.   "Sets current buffer to the Usenet news article reader buffer."
  71.   (and (eq major-mode hnews:lister) (set-buffer gnus-article-buffer)))
  72.  
  73. (defun rnews:summ-msg-to ()
  74.   "Displays news message associated with current summary header."
  75.   (let ((article (gnus-summary-article-number)))
  76.     (if (or (null gnus-current-article)
  77.         (/= article gnus-current-article))
  78.     ;; Selected subject is different from current article's.
  79.     (gnus-summary-display-article article))))
  80.  
  81.  
  82. ;;; Overlay 'gnus-inews-article' from "gnuspost.el" to make it include
  83. ;;; any signature before Hyperbole button data.  Does this by having
  84. ;;; signature inserted within narrowed buffer and then applies a hook to
  85. ;;; have the buffer widened before sending.
  86. (hypb:function-symbol-replace
  87.   'gnus-inews-article 'widen 'hmail:msg-narrow)
  88.  
  89. ;;; Overload this function from "rnewspost.el" for supercite compatibility
  90. ;;; only when supercite is in use.
  91. (if (hypb:supercite-p)
  92.     (defun news-reply-yank-original (arg)
  93.       "Supercite version of news-reply-yank-original.
  94. Insert the message being replied to in the reply buffer. Puts point
  95. before the mail headers and mark after body of the text.  Calls
  96. mail-yank-original to actually yank the message into the buffer and
  97. cite text.  
  98.  
  99. If mail-yank-original is not overloaded by supercite, each nonblank
  100. line is indented ARG spaces (default 3).  Just \\[universal-argument]
  101. as ARG means don't indent and don't delete any header fields."
  102.       (interactive "P")
  103.       (mail-yank-original arg)
  104.       (exchange-point-and-mark)
  105.       (run-hooks 'news-reply-header-hook))
  106.   )
  107.  
  108. ;;; ************************************************************************
  109. ;;; Private variables
  110. ;;; ************************************************************************
  111. ;;;
  112. (var:append 'gnus-Inews-article-hook '(widen))
  113. ;;;
  114. ;;; Hide any Hyperbole button data and highlight buttons if possible
  115. ;;; in news article being read.
  116. (var:append 'gnus-article-prepare-hook
  117.         (if (fboundp 'hproperty:but-create)
  118.         '(hmail:msg-narrow hproperty:but-create)
  119.           '(hmail:msg-narrow)))
  120.  
  121. (if (fboundp 'hproperty:but-create)
  122.     (var:append 'gnus-summary-prepare-hook '(hproperty:but-create)))
  123.  
  124. ;;; Try to setup comment addition as the first element of these hooks.
  125. (if (fboundp 'add-hook)
  126.     ;; Called from 'news-post-news' if prev unsent article exists and user
  127.     ;; says erase it.  Add a comment on Hyperbole button support.
  128.     (progn
  129.       (add-hook 'news-setup-hook 'smail:comment-add)
  130.       ;; Called from 'news-post-news' if no prev unsent article exists.
  131.       ;; Add a comment on Hyperbole button support.
  132.       (add-hook 'news-reply-mode-hook 'smail:comment-add))
  133.   (var:append 'news-setup-hook '(smail:comment-add))
  134.   (var:append 'news-reply-mode-hook '(smail:comment-add)))
  135.  
  136. (provide 'hgnus)
  137.